#include <algorithm>
using namespace std;
class Solution {
public:
    bool canJump(int A[], int n) {
        int i,j;
        for (i=0, j=0;i<=j && i<n;i++)
            j=max(j, i+A[i]);
        return j>=n-1;
    }
};
